package mumu.android.animate.property;

import mumu.android.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;

/**
 * 动画集合
 * 
 * @author Administrator
 * 
 */
public class animateset extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.animate);
		final ImageView img = (ImageView) findViewById(R.id.img_1);
		img.setImageResource(R.drawable.ic_launcher);
		/**
		 * 参数1：x轴的起始位置 参数2：x轴的终止位置 参数3: y轴的起始位置 参数4：y轴的终止位置
		 */
		Animation animation = new TranslateAnimation(0, 500, 0, 500);
		animation.setDuration(1000);

		final AnimationSet animationSet = new AnimationSet(false);
		animationSet.addAnimation(animation);
		animationSet.addAnimation(AnimationUtils.loadAnimation(this, R.anim.scale_enter));
		animationSet.setFillAfter(true);// 停止在运动结束的地方，默认为false,会回到初始位置。
		img.setImageResource(R.drawable.image_indicator);
		img.startAnimation(animationSet);
		img.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				img.startAnimation(animationSet);
			}
		});
	}

}
